public class demo2 {
    public static void main(String[] args) {
        final Object object = new Object();
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                synchronized (object){
                    while(!Thread.currentThread().isInterrupted()){
                        try {
                            Thread.sleep(10000);
                        } catch (InterruptedException e) {
                            //throw new RuntimeException(e);
                        }

                    }
                }
            }
        },"t1");
        t1.start();
        t1.interrupt();
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                synchronized (object){
                    System.out.println("hehe");
                }
            }
        },"t2");
        t2.start();
    }
}
